﻿
using System;
using System.Collections.Generic;
using System.Windows.Threading;
using MyFramework.Common.Enums;
namespace MyFramework.Common.Interfaces
{
    /// <summary>
    /// Interface controller.
    /// </summary>
    public interface IController : IEntity, IDisposable
    {
        #region Properties

        /// <summary>
        /// Gets the controller id.
        /// </summary>
        /// <value>
        /// The controller id.
        /// </value>
        Guid ControllerId { get; }

        /// <summary>
        /// Gets the action names.
        /// </summary>
        /// <value>
        /// The action names.
        /// </value>
        string[] ActionNames { get; }

        /// <summary>
        /// Gets or sets the name of the logical.
        /// </summary>
        /// <value>
        /// The name of the logical.
        /// </value>
        Type Type { get; set; }

        /// <summary>
        /// Gets the view model.
        /// </summary>
        /// <value>
        /// The view model.
        /// </value>
        IViewModel ViewModel { get; }

        /// <summary>
        /// Gets or sets the state.
        /// </summary>
        /// <value>
        /// The state.
        /// </value>
        ControllerState State { get; set; }

        /// <summary>
        /// Gets the custom property bag.
        /// </summary>
        /// <value>
        /// The custom property bag.
        /// </value>
        CustomPropertyCollection CustomPropertyBag { get; }

        /// <summary>
        /// Gets the dispatcher.
        /// </summary>
        /// <value>
        /// The dispatcher.
        /// </value>
        Dispatcher Dispatcher { get; }

        #endregion

        #region Methods

        /// <summary>
        /// Initializes the specified initialize parameters.
        /// </summary>
        /// <param name="initParameters">The initialize parameters.</param>
        void Initialize(IDictionary<string, object> initParameters);

        /// <summary>
        /// Does the startup action.
        /// </summary>
        void DoStartupAction();

        /// <summary>
        /// Does the action.
        /// </summary>
        /// <param name="actionName">Name of the action.</param>
        /// <param name="actionParameters">The action parameters.</param>
        void DoAction(string actionName, params object[] actionParameters);

        /// <summary>
        /// Determines whether this instance [can do action] the specified action name.
        /// </summary>
        /// <param name="actionName">Name of the action.</param>
        /// <param name="actionParameters">The action parameters.</param>
        /// <returns>
        ///   <c>true</c> if this instance [can do action] the specified action name; otherwise, <c>false</c>.
        /// </returns>
        bool CanDoAction(string actionName, params object[] actionParameters);

        /// <summary>
        /// Existses the action.
        /// </summary>
        /// <param name="actionName">Name of the action.</param>
        /// <returns></returns>
        bool ExistsAction(string actionName);

        /// <summary>
        /// Tries the do action.
        /// </summary>
        /// <param name="actionName">Name of the action.</param>
        /// <param name="actionParameters">The action parameters.</param>
        /// <returns></returns>
        bool TryDoAction(string actionName, params object[] actionParameters);

        /// <summary>
        /// Unloads the view.
        /// </summary>
        /// <param name="view">The view.</param>
        void UnloadView(IView view);

        #endregion

    }
}
